import 'package:flutter/cupertino.dart';

import '../../mine_business/widgets/simple_text_tab.dart';

class UserFollowMenuTab extends StatefulWidget {
  final int? uid;

  UserFollowMenuTab({this.uid});

  @override
  State<StatefulWidget> createState() {
    return _UserFollowMenuTabState();
  }
}

class _UserFollowMenuTabState extends State<UserFollowMenuTab> {
  List<String> get subTypes => [
        '博主',
        '话题',
      ];

  int pageIndex = 0;
  PageController pageController = PageController();

  @override
  void initState() {
    super.initState();
    WidgetsBinding.instance.addPostFrameCallback((timeStamp) {});
  }

  void _changeSubType(int index) {
    pageIndex = index;
    pageController.jumpToPage(index);
    setState(() {});
  }

  @override
  Widget build(BuildContext context) {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.stretch,
      children: [
        Container(
          height: 32,
          padding: EdgeInsets.symmetric(horizontal: 12),
          child: SimpleTextTab(
            types: subTypes,
            typeIndex: pageIndex,
            onTapItem: _changeSubType,
          ),
        ),
        Expanded(
          child: PageView(
            controller: pageController,
            onPageChanged: (index) {
              pageIndex = index;
              setState(() {});
            },
            children: [
              //_
            ],
          ),
        ),
      ],
    );
  }
}
